
import ejb.MessageFacade;
import entity.Message;
import java.io.Serializable;
import java.util.List;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;

@ManagedBean(name = "SomeBean")
@SessionScoped
public class DataBean implements Serializable {

    @EJB
    private MessageFacade messageFacade;
    private String message;
    private List<Message> messages = null;

    public List<Message> getMessages() {
        return messages;
    }

    public void setMessages(List<Message> messages) {
        this.messages = messages;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public void update() {
        messages = messageFacade.findAll();
        System.out.println("AJAX message updated");
    }
}